home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_DLCCLAY.PRG
< prev
next >
Wrap
Text File
|
1993-05-06
|
5KB
|
193 lines
PROCEDURE _DLCCLay
PARAMETERS pcPanel, pcFile
*----------------------------------------------------------------------------
* NAME
* _DLCCLay -
*
* DESCRIPTION
*
* PARAMETERS
* pcPanel =
* pcFile =
*
*----------------------------------------------------------------------------
PRIVATE ll_talk, ll_trap, ll_escape
ll_talk = _TalkMode( .F. ) && Save current TALK mode.
ll_trap = SET( "TRAP" ) = "ON"
SET TRAP OFF
ll_escape = SET( "ESCAPE" ) = "ON" && Save the ESCAPE state
SET ESCAPE OFF && Force ESCAPE OFF so prgs can't be stopped
cDBBLib = "DBBDSGN"
IF .NOT. ( cDBBLib $ SET("LIBRARY") )
lError = .F.
ON ERROR lError = .T.
SET LIBRARY TO ( cDBBLib )
IF lError
lError = .F.
SET LIBRARY TO HOME() + cDBBLib
IF lError
DO _Err_Box WITH [DBB not installed correctly]
RETURN
ENDIF
ENDIF
ON ERROR
ENDIF
FXL_NoChng = .F.
PUBLIC ARRAY DLCCDEV[ 6 ]
IF TYPE( "FXL_DEV" ) = "L" .AND. FXL_DEV
*-- CK_OPTI_1 - [ ] ~Developer mode
DLCCDEV[ 1 ] = .F.
ELSE
RELEASE FXL_DEV
PUBLIC FXL_DEV
FXL_DEV = .F.
DLCCDEV[ 1 ] = .T.
ENDIF
IF TYPE( "DBW_HELP" ) = "C"
DLCCDEV[ 2 ] = LEFT( DBW_HELP + SPACE( 8 ), 8 )
ELSE
*-- EF_HEFI_1 - XXXXXXXX
DLCCDEV[ 2 ] = "DLGHELP" + SPACE( 1 )
ENDIF
*-- BT_OK - Ok
DLCCDEV[ 3 ] = .T.
*-- BT_CANCEL - Cancel
DLCCDEV[ 4 ] = .F.
*-- BT_HELP - ~Help
DLCCDEV[ 5 ] = .F.
FXL_Cancel = .F.
DO DLCCDEV
IF .NOT. FXL_Cancel && The user clicked on OK
RELEASE DBW_HELP, FXL_DEV
PUBLIC DBW_HELP, FXL_DEV
IF DLCCDev[ 1 ] && Development mode
FXL_DEV = .T.
ENDIF
DBW_HELP = DLCCDev[ 2 ] && Help file name
ENDIF
*--------------------------
*-- Restore the environment
*--------------------------
RELEASE DLCCDEV
IF ll_trap
SET TRAP ON
ELSE
SET TRAP OFF
ENDIF
IF ll_escape
SET ESCAPE ON
ELSE
SET ESCAPE OFF
ENDIF
IF _TalkMode( ll_talk )
ENDIF
RETURN
*-- EOP: _DLCCLay WITH pcPanel, pcFile
PROCEDURE _Err_Box
PARAMETERS pc_msg
*----------------------------------------------------------------------------
* NAME
* _Err_Box - Display an error box
*
* SYNOPSIS
* DO _Err_Box WITH <pc_msg>
*
* DESCRIPTION
* _Err_Box will display the <pc_msg> string in a box and prompt the
* user to press any key to continue processing. _Err_Box will display
* the message based on the length of <pc_msg>.
*
* PARAMETERS
* pc_msg - the error message to display in the box. If the length is
* greater than 76, the trailing part is chopped off.
*
* EXAMPLE
* DO _Err_Box WITH "Incorrect window size"
* Displays the message in a window as follows at row 9 on the screen:
* +------------------------------+
* | |
* | Incorrect window size |
* | |
* | Press any key to continue... |
* | |
* +------------------------------+
* Note that the width of the window will increase to accommodate a longer
* message string.
*
* LIMITATIONS
* Truncates the message after 76 characters. Assumes an 80 character
* wide screen. Looks best with SET CURSOR OFF.
*
*----------------------------------------------------------------------------
PRIVATE lc_anykey, lc_msg, lc_msglen, lc_win, ln_press, ln_width, ll_trap,;
ll_escape
lc_anykey = [Press any key to continue...]
ln_press = LEN( lc_anykey )
lc_win = WINDOW() && Currently activated window if any
lc_msg = LTRIM( RTRIM( pc_msg ) ) && Trimmed message
ln_msglen = LEN( lc_msg ) && Trimmed length of message
ln_width = 0 && Width of display area in window.
ll_escape = SET("ESCAPE") = "ON"
IF TYPE( "FXL_DEV" ) = "L" .AND. FXL_DEV
SET ESCAPE ON
ELSE
SET ESCAPE OFF
ENDIF
*-- Determine the width needed for the window:
IF ln_msglen <= ln_press
ln_width = ln_press
ELSE
*-- Make sure the message fits in the window:
IF ln_msglen > 76
lc_msg = LEFT( lc_msg, 76 )
ln_msglen = 76
ENDIF
ln_width = ln_msglen
ENDIF
DEFINE WINDOW _err_box FROM 9, ((76 - ln_width) + .5) / 2 ;
TO 15, (ln_width + 83) / 2 DOUBLE
ln_width = ( ln_width + 2 )
*-- Display the message and prompt to the window and wait for a key press
ACTIVATE WINDOW _err_box
@ 1, ( ln_width - ln_msglen ) / 2 SAY lc_msg
@ 3, ( ln_width - ln_press ) / 2 SAY lc_anykey
SET CONSOLE OFF && For mouse click recognition
WAIT
SET CONSOLE ON
*-- Clean up the window display and reactivate the previous window
RELEASE WINDOW _err_box
IF ISBLANK( lc_win )
ACTIVATE SCREEN
ENDIF
IF ll_escape
SET ESCAPE ON
ELSE
SET ESCAPE OFF
ENDIF
RETURN
*-- EOP: _Err_Box WITH pc_msg